<?php


namespace App\Transformers\Order;


use App\Models\OrderEconomize;
use League\Fractal\TransformerAbstract;

class OrderEconomizesTransformer extends TransformerAbstract
{

    public function transform(OrderEconomize $data)
    {
        return [
            'id' => $data->id,
            'order_id' => $data->order_id ?? '',
            'user_id' => $data->user_id ?? '',
            'order_type' => $data->order_type ?? '',
            'order_type_text' => $data->orderTypeEnum[$data->order_type] ?? '',
            'pay_price' => $data->pay_price ?? '',
            'postage_price' => $data->postage_price ?? '',
            'member_price' => $data->member_price ?? '',
            'offline_price' => $data->offline_price ?? '',
            'coupon_price' => $data->coupon_price ?? '',
            'deleted_at' => $data->deleted_at ? $data->deleted_at->format("Y-m-d H:i:s") : '',
            'created_at' => $data->created_at ? $data->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $data->updated_at ? $data->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }



}
